#define BOOST_FILESYSTEM_NO_DEPRECATED
#include "helper.hpp"
#include <boost/filesystem.hpp>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>

namespace amber {
namespace bf = boost::filesystem;

std::vector<std::string> listFiles(std::string dir, bool recursive)
{
    std::vector<std::string> list;
    listFiles(dir, &list, recursive);
    return list;
}

void listFiles(std::string dir, std::vector<std::string>* list, bool recursive)
{

    if (bf::is_directory(dir)) {
        for (bf::directory_entry& file : bf::directory_iterator(dir)) {
            if (bf::is_regular_file(file.path().string())) {
                list->push_back(file.path().string());
            }
            if (recursive) {
                listFiles(file.path().string(), list, recursive);
            }
        }
    }

    return;
}
}